
/******************************************************************************
*@file  : app.c
*@brief : application
******************************************************************************/

#include "app.h"   


volatile uint32_t g_key_press;


/******************************************************************************
*@brief : app test
*@param : none
*@return: none
******************************************************************************/
void APP_Test(void)
{
    printfS("GPIO Demo\r\n");
    printfS("\r\n");
    printfS("Press the key to switch the light status\r\n");
    printfS("\r\n");
    
	BSP_LED_Init();
	BSP_LED_On();
    HAL_Delay(250);
	BSP_LED_Off();
    HAL_Delay(250);
	BSP_LED_On();
    HAL_Delay(250);
	BSP_LED_Off();
    HAL_Delay(250);
	BSP_LED_On();
	
    g_key_press = 0;
    BSP_PB_Init();
        
    while(1)
    {
        if (g_key_press)
        {
            HAL_Delay(100);
            g_key_press = 0;
            BSP_LED_Toggle();
        }
		HAL_Delay(50);
    };
}


void HAL_EXTI_LineCallback(uint32_t Line)
{
	if (Line == BSP_PB_PIN)
    {
        g_key_press = 1;
    }
}

